package com.puman.feign.controller;

import com.puman.feign.model.User;
import com.puman.feign.service.HelloService;
import com.puman.feign.service.RefactorHelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ConsumerController {
    @Autowired
    HelloService helloService;
    @Autowired
    RefactorHelloService refactorHelloService;


    @RequestMapping(value = "/feign-consumer",method = RequestMethod.GET)
    public String helloConsumer(){
        return helloService.hello();
    }
    @RequestMapping(value = "/feign-consumer2",method = RequestMethod.GET)
    public String helloConsumer2(){
        StringBuilder sb = new StringBuilder();
        sb.append(helloService.hello()).append("---");
        sb.append(helloService.hello("闫发泽")).append("---");
        sb.append(helloService.hello("闫发泽",1L)).append("---");
        sb.append(helloService.hello(new User("yfz",21L)));
        return sb.toString();
    }
    @RequestMapping(value = "/feign-consumer3",method = RequestMethod.GET)
    public String helloConsumer3(){
        StringBuilder sb = new StringBuilder();
        sb.append(refactorHelloService.hello("闫发泽")).append("---");
        sb.append(refactorHelloService.hello("闫发泽",1L)).append("---");
        sb.append(refactorHelloService.hello(new com.puman.helloserviceapi.model.User("yfz",21L)));
        return sb.toString();
    }
}

